package com.fable.sp.core.widget;

import com.fable.sp.core.domain.WidgetInstance;
import com.fable.sp.core.template.freemarker.Ignore;

import java.util.Enumeration;
import java.util.Map;

/**
 * .
 *
 * @author stormning on 16/8/8.
 */
@Ignore
public interface WidgetRequest {

    String LIFECYCLE_PHASE = "_widget_lifecycle";
    String ACTION_PHASE = "ACTION_PHASE";
    String RENDER_PHASE = "RENDER_PHASE";
    String EVENT_PHASE = "EVENT_PHASE";

    Object getFieldValue();

    WidgetInstance getWidgetInstance();

    Map<String, Preference> getPreferences();

    ContainerContext getContainerContext();

    WidgetSession getWidgetSession();

    WidgetSession getWidgetSession(boolean create);

    /**
     * 组件内属性
     *
     * @param name
     * @param object
     */
    void setAttribute(String name, Object object);

    void removeAttribute(String name);

    Object getAttribute(String name);

    Enumeration<String> getAttributeNames();

    String getParameter(String name);

    Enumeration<String> getParameterNames();

    String[] getParameterValues(String name);

    Map<String, String[]> getParameterMap();

    /**
     * 组件容器或http请求头属性
     *
     * @param name
     * @return
     */
    String getProperty(String name);

    Enumeration<String> getProperties(String name);

    Enumeration<String> getPropertyNames();

    WidgetMode getWidgetMode();
}
